package com.cn.serverline.lineicp.workshopPlan.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.stylefeng.roses.kernel.office.api.pojo.report.ExcelExportParam;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cn.serverline.lineicp.workshopPlan.entity.PlanLineAutomatic;
import com.cn.serverline.lineicp.workshopPlan.entity.request.LineAutomaticTasksRequest;
import com.cn.serverline.lineicp.workshopPlan.mapper.PlanLineAutomaticMapper;
import com.cn.serverline.lineicp.workshopPlan.service.IPlanLineAutomaticService;
import com.cn.serverline.lineicp.workshopPlan.util.DateUtil;
import org.springframework.stereotype.Service;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;

import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.HashMap;
import java.util.List;


/**
 * <p>
 * 周总装排产下发 服务实现类
 * </p>
 *
 * @author 田江余
 * @since 2024-08-10
 */
@Service("PlanLineAutomaticServiceImpl")
public class PlanLineAutomaticServiceImpl extends ServiceImpl<PlanLineAutomaticMapper, PlanLineAutomatic> implements IPlanLineAutomaticService {

    /**
     * 排产下发
     * @param planLineAutomatic 请求参数
     */
    @Override
    public void add(PlanLineAutomatic planLineAutomatic) {
        //创建时间
        planLineAutomatic.setCreateTime(DateUtil.getTimestamp());
        this.save(planLineAutomatic);
    }

    /**
     * 撤回排产下发
     * @param planLineAutomatic 请求参数
     */
    @Override
    public void del(PlanLineAutomatic planLineAutomatic) {
        this.removeById(planLineAutomatic);
    }

    @Override
    public void edit(PlanLineAutomatic planLineAutomatic) {
        //修改时间
        planLineAutomatic.setUpdateTime(DateUtil.getTimestamp());
        this.updateById(planLineAutomatic);
    }


    @Override
    public PlanLineAutomatic detail(PlanLineAutomatic planLineAutomatic) {
        return this.getById(planLineAutomatic);
    }

    @Override
    public PageResult<PlanLineAutomatic> findPage(PlanLineAutomatic planLineAutomatic) {
        LambdaQueryWrapper<PlanLineAutomatic> wrapper = new LambdaQueryWrapper<>();
        // 筛选主要属性
        /* wrapper.select(PlanLineAutomatic::getId, PlanLineAutomatic::getPositionName, PlanLineAutomatic::getCode, PlanLineAutomatic::getRemark,
        PlanLineAutomatic::getPositionSort, BaseEntity::getCreateTime);*/

        Page<PlanLineAutomatic> sysRolePage = this.page(PageFactory.defaultPage(), wrapper);
        return PageResultFactory.createPageResult(sysRolePage);
    }


}
